import { AccountListGetResultModel, AccountParams } from './model';
import { defHttp } from '@/utils/http/axios';

enum Api {
  //部门
  DeptList = '/basic-api/v2/admin/dept/list',
  DeptAdd = '/basic-api/v2/admin/dept/add',
  DeptDelete = '/basic-api/v2/admin/dept/delete',

  //角色
  RoleList = '/basic-api/v2/admin/role/list',
  RoleAdd = '/basic-api/v2/admin/role/add',
  RoleDelete = '/basic-api/v2/admin/role/delete',
  RoleMenuList = '/basic-api/v2/admin/role/menulist',
  //菜单
  MenuList = '/basic-api/v2/admin/menu/list',
  MenuAdd = '/basic-api/v2/admin/menu/add',
  MenuDelete = '/basic-api/v2/admin/menu/delete',
  MenuParentList = '/basic-api/v2/admin/menu/selectlist',

  //账号
  AdminPage = '/basic-api/v2/admin/admin/page',
  AdminAdd = '/basic-api/v2/admin/admin/add',
  AdminDelete = '/basic-api/v2/admin/admin/delete',
  AdminPasswordUpdate = '/basic-api/v2/admin/admin/password',
  AdminStatusUpdate = '/basic-api/v2/admin/admin/status',
}

// 部门
export const getDeptList = (params?: any) =>
  defHttp.post<any>({ url: Api.DeptList, params }, { isTransformResponse: true });
export const doDeptAdd = (params?: any) =>
  defHttp.post<any>({ url: Api.DeptAdd, params }, { isTransformResponse: false });
export const doDeptDelete = (params?: any) =>
  defHttp.post<any>({ url: Api.DeptDelete, params }, { isTransformResponse: false });

//角色
export const getRoleList = (params?: any) =>
  defHttp.post<any>({ url: Api.RoleList, params }, { isTransformResponse: true });
export const doRoleAdd = (params?: any) =>
  defHttp.post<any>({ url: Api.RoleAdd, params }, { isTransformResponse: false });
export const doRoleDelete = (params?: any) =>
  defHttp.post<any>({ url: Api.RoleDelete, params }, { isTransformResponse: false });

export const getRoleMenuList = (params?: any) =>
  defHttp.post<any>({ url: Api.RoleMenuList, params });

//菜单
export const getMenuList = (params?: any) =>
  defHttp.post<any>({ url: Api.MenuList, params }, { isTransformResponse: true });
export const doMenuAdd = (params?: any) =>
  defHttp.post<any>({ url: Api.MenuAdd, params }, { isTransformResponse: false });
export const doMenuDelete = (params?: any) =>
  defHttp.post<any>({ url: Api.MenuDelete, params }, { isTransformResponse: false });
export const getMenuParentList = (params?: any) =>
  defHttp.post<any>({ url: Api.MenuParentList, params });
//账号
export const getAdminList = (params: AccountParams) =>
  defHttp.post<AccountListGetResultModel>({ url: Api.AdminPage, params });

export const doAdminAdd = (params?: any) =>
  defHttp.post<any>({ url: Api.AdminAdd, params }, { isTransformResponse: false });
export const doAdminDelete = (params?: any) =>
  defHttp.post<any>({ url: Api.AdminDelete, params }, { isTransformResponse: false });
export const doAdminPasswordUpdate = (params?: any) =>
  defHttp.post<any>({ url: Api.AdminPasswordUpdate, params }, { isTransformResponse: false });
export const doAdminStatusUpdate = (params?: any) =>
  defHttp.post<any>({ url: Api.AdminStatusUpdate, params }, { isTransformResponse: false });
